package net.huashitong.ssydt.common.entity.vo;

import io.swagger.annotations.ApiModelProperty;
import net.huashitong.ssydt.common.constant.CommonConsts;
import net.huashitong.ssydt.common.entity.SsCommonBanner;

import java.io.Serializable;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.28
 */
public class CommonBannerVO implements Serializable {

    private static final long serialVersionUID = 6840365869048499813L;
    @ApiModelProperty(value = "图片url")
    private String imgUrl;//图片url
    @ApiModelProperty(value = "关联类型(01链接 02文章 03试卷)")
    private String relationType;//关联类型
    @ApiModelProperty(value = "关联Id")
    private Long relationId;//关联Id
    @ApiModelProperty(value = "链接地址")
    private String url;//链接地址

    public CommonBannerVO(SsCommonBanner ssCommonBanner) {
        this.imgUrl = ssCommonBanner.getImgUrl();
        this.relationType = ssCommonBanner.getRelationType();
        if (CommonConsts.BannerRelationType.LINK.equals(this.relationType)) {
            this.url = ssCommonBanner.getRelationId();
        } else {
            this.relationId = Long.parseLong(ssCommonBanner.getRelationId());
        }
    }


    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public String getRelationType() {
        return relationType;
    }

    public void setRelationType(String relationType) {
        this.relationType = relationType;
    }

    public Long getRelationId() {
        return relationId;
    }

    public void setRelationId(Long relationId) {
        this.relationId = relationId;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
